using UnityEngine;
using System.Collections;

public class CoConvert 
{
    int width;

    public CoConvert(int width)
    {
        this.width = width;		
    }

    public int ConvertXYToIndex(int x, int y)
    {
        int result = y * width;
		
        return result + x;
    }

    public void ConvertIndexToXY(int i, ref int x, ref int y)
    {
        x = i % width;
        y = i / width;
    }

    
}
